home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / latex209 / contrib / pphlp / pphlp.com (.txt) < prev    next >
LaTeX Document  |  1993-01-11  |  6KB  |  146 lines

  1. $ !!! ======================================================================
  2. $ !!!  @VAX-VMS-shell{
  3. $ !!!     filename        = "pphlp.com",
  4. $ !!!     version         = "1.0",
  5. $ !!!     date            = "19 July 1992",
  6. $ !!!     time            = "14:05:50.47 ",
  7. $ !!!     author          = "Norman Gray",
  8. $ !!!     address         = "Department of Physics
  9. $ !!!                        Open University
  10. $ !!!                        Milton Keynes
  11. $ !!!                        MK7 6AA, UK",
  12. $ !!!     e-mail          = "N.O.Gray@open.ac.uk (Internet)",
  13. $ !!!     telephone       = "+44 908 652279",
  14. $ !!!     FAX             = "+44 908 653744",
  15. $ !!!     archived        = "Aston, SHSU",
  16. $ !!!     keywords        = "hlp-files, VMS, help",
  17. $ !!!     abstract        = "This file is part of the PPHLP package, which
  18. $ !!!                        allows both printed manuals and VMS help library
  19. $ !!!                        modules to be prepared from a single file.",
  20. $ !!!     codetable       = "ISO/Ascii",
  21. $ !!!     checksum        = "22288 163 899 6257",
  22. $ !!!     docstring       = "This is the DCL com-file which drives the PPhlp
  23. $ !!!                        package.  It does so by parsing the command line
  24. $ !!!                        and the input file specifications, and preparing a
  25. $ !!!                        file pphlpdefs.tex, which is read in during the
  26. $ !!!                        next stage, when this file LaTeX's the principal 
  27. $ !!!                        file, pphlp.tex.  It finally renames the files
  28. $ !!!                        pphlp.dvi and pphlp.lis to match the name of the
  29. $ !!!                        original .hlp file.
  30. $ !!!                        
  31. $ !!!                        The checksum field above contains a CRC-16
  32. $ !!!                        checksum as the first value, followed by the
  33. $ !!!                        equivalent of the standard UNIX wc (word 
  34. $ !!!                        count) utility output of lines, words, and
  35. $ !!!                        characters.  This is produced by Robert 
  36. $ !!!                        Solovay's checksum utility."
  37. $ !!! }
  38. $ !!! ======================================================================
  39. $!+ This procedure will prettyprint an |.hlp| file by \LaTeX ing the file
  40. $!  |pphlp.tex|.
  41. $!  The only parameter is the name of the file to be set---the routine first
  42. $!  searches for a file with extension |.help|, then for |.hlp|.
  43. $!  Information is passed to |pphlp.tex| via the file |pphlpdefs.tex|, which
  44. $!  supplies the documentstyle, and has the following definitions:
  45. $!  \medskip
  46. $!  \begin{tabular}{lp{4in}}
  47. $!  |\pphlpstyleoptions & The style options to be used.\\
  48. $!  |\pphlpname|    & The full file name, including version number.\\
  49. $!  |\pphlphead|    & The bare file name, without directory and extension. \\
  50. $!  |\pphlpextra|   & Any extra information which might be of use.  This isn't
  51. $!            currently used. \\
  52. $!  |\pphlppreamble|& Commands to go in the preamble.
  53. $!  \end{tabular}
  54. $!  When this com file is invoked, extra documentstyle options may be provided
  55. $!  by prefixing them on the command line with a hyphen, so that
  56. $!  \begin{center}\tt
  57. $!  pphlp -acsfigs,twocolumn helpfile
  58. $!  \end{center}
  59. $!  would set the file |helpfile.hlp| with the |[twoside,acsfigs,twocolumn]|
  60. $!  options.
  61. $!  Also, commands may be inserted into the preamble, by prefixing them with a
  62. $!  plus sign, so that
  63. $!  \begin{center}\tt
  64. $!  pphlp +\makeindex helpfile
  65. $!  \end{center}
  66. $!  would insert the |\makeindex| command into the preamble.
  67. $!  Finally, extra qualifiers may be added to the LaTeX command.
  68. $!  \medskip
  69. $   source_dir := phut:[util.local.pphlp]
  70. $   param = 0
  71. $!   docopts = "twoside"
  72. $   docopts = ""
  73. $   preamble = ""
  74. $   quals = ""
  75. $   fname_p = ""
  76. $   parse_loop:
  77. $    param = param + 1
  78. $    if p'param .eqs. "" then goto finished_parse
  79. $    ch1 = f$extract (0,1,p'param)
  80. $    if ch1 .eqs. "-"
  81. $    then
  82. $        if docopts .eqs. ""
  83. $        then
  84. $        docopts = f$edit (f$extract (1,99,p'param), "lowercase")
  85. $        else
  86. $        docopts = docopts + "," + -
  87.             f$edit (f$extract (1,99,p'param), "lowercase")
  88. $        endif
  89. $    else
  90. $    if ch1 .eqs. "+"
  91. $    then
  92. $        preamble = preamble + -
  93.             f$edit (f$extract (1,99,p'param), "lowercase") + " "
  94. $    else
  95. $    if ch1 .eqs. "/"
  96. $    then
  97. $        quals = quals + p'param
  98. $    else
  99. $        fname_p = p'param
  100. $    endif
  101. $    endif
  102. $    endif
  103. $    goto parse_loop
  104. $   finished_parse:
  105. $   if fname_p .eqs. "" then inquire fname_p "Which file? "
  106. $   fname = f$search (f$parse (fname_p,".help")) ! check it exists, and fill in version number
  107. $   if fname .eqs. ""
  108. $   then
  109. $    fname = f$search (f$parse (fname_p,".hlp"))
  110. $    if fname .eqs. ""
  111. $    then
  112. $        write sys$output f$fao ("File !AS not found.", -
  113.         f$parse (fname_p,".hlp",,,"syntax_only"))  ! doesn't check dir'y exists
  114. $        exit
  115. $    endif
  116. $   endif
  117. $   outfilename = f$parse (fname,,,"name")      ! just filename
  118. $   open/write argfile pphlpdefs.tex
  119. $   write argfile "{\catcode`\$=11 \catcode`\_=11"   ! so we can read in ...
  120. $   if docopts .nes. "" then -
  121.     write argfile f$fao ("\gdef\pphlpstyleoptions{!AS}", docopts)
  122. $   write argfile f$fao ("\gdef\pphlpname{!AS}", -
  123.         f$edit (fname, "lowercase"))                ! full file name
  124. $   write argfile f$fao ("\gdef\pphlphead{!AS}", -
  125.     f$edit (outfilename, "lowercase"))        ! file name
  126. $   write argfile f$fao ("\gdef\pphlpextra{last revised !AS}", -
  127.         f$file(fname,"cdt"))    ! file creation date
  128. $   if preamble .nes. "" then -
  129.     write argfile f$fao ("\gdef\pphlppreamble{!AS}", preamble)
  130. $   write argfile "}"
  131. $   close argfile
  132. $   define/user sys$input sys$command
  133. $   on error then continue
  134. $   latex 'source_dir'pphlp 'quals' ! which reads in |prettydefs.tex|
  135. $   rename/nolog pphlp.dvi,.lis 'outfilename
  136. $   delete/noconfirm/nolog pphlpdefs.tex;*
  137. $!  +Only the |.dvi| and |.lis| files are renamed---the |.aux| is left as it
  138. $!  is.  If there are cross-references within the prettyprinted file, then the
  139. $!  |.aux| file containing them must be called |pphlp.aux| if \LaTeX\ is to
  140. $!  find it. \-
  141. $   write sys$output ""
  142. $   write sys$output "Output written on ",f$parse(outfilename,".DVI")
  143. $   write sys$output "Transcript written on ",f$parse(outfilename,".LIS")
  144. $   write sys$output ""
  145. $   EXIT
  146.